
def Push(TopOfStackPointer):
    newItem = input()
    if TopOfStackPointer < MaxStackSize-1:
        TopOfStackPointer+=1
        Stack[TopOfStackPointer]=newItem
    return TopOfStackPointer


def PushByValue(TopOfStackPointer,newItem):
    if TopOfStackPointer < MaxStackSize-1:
        TopOfStackPointer+=1
        Stack[TopOfStackPointer]=newItem
    return TopOfStackPointer

def Pop(TopOfStackPointer):
    if TopOfStackPointer > -1:
        topValue = Stack[TopOfStackPointer]
        Stack[TopOfStackPointer]=None
        TopOfStackPointer-=1
    return TopOfStackPointer,topValue

def setUpStack(stackArray,topOfStack):
    for i in range(100):
        stackArray.append(i)
    topOfStack = 99
    return stackArray,topOfStack

if __name__ == '__main__':
    BaseOfStackPointer = 0
    TopOfStackPointer = -1
    MaxStackSize = 8
    Stack = [None for i in range(MaxStackSize)]
    # for i in range(4):
    #     TopOfStackPointer = Push(TopOfStackPointer)
    # # TopOfStackPointer =  Pop(TopOfStackPointer)
    # # TopOfStackPointer =  Pop(TopOfStackPointer)
    # # TopOfStackPointer =  Pop(TopOfStackPointer)
    # print(Stack)
    tokens = ["2","1","+","4","*"]
    for i in tokens:
        if i.isdigit():
            TopOfStackPointer = PushByValue(TopOfStackPointer,i)
        else:
            TopOfStackPointer,a = Pop(TopOfStackPointer)
            TopOfStackPointer,b = Pop(TopOfStackPointer)
            result =eval(str(b)+ i+ str(a))
            TopOfStackPointer = PushByValue(TopOfStackPointer,result)
    print(result)



